home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-31 | 52.3 KB | 1,345 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Tue, 19 Sep 95 Volume 3 : Issue 111
-
- Today's Topics:
-
- Difference between BlockMove() and BlockMoveData()?
- Easiest way to get vRefNum of startup volume?
- Pointers to functions on the PowerPC?
- Preferences Database project discussion
- QuickTime volumes
- Random Numbers
- [Q] Gestalt to determine number of serial ports?
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
- (pottier@clipper.ens.fr).
-
- The digest is a collection of article threads from the internet newsgroups
- comp.sys.mac.programmer.help, csmp.tools and csmp.misc. It is designed for
- people who read news semi-regularly and want an archive of the discussions.
- If you don't know what a newsgroup is, you probably don't have access to
- it. Ask your systems administrator(s) for details. If you don't have access
- to news, you may still be able to post messages to the group by using a
- mail server like anon.penet.fi (mail help@anon.penet.fi for more
- information).
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- nef.ens.fr). Article threads are not added to the digest until the last
- article added to the thread is at least two weeks old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The digest is officially distributed by two means, by email and ftp.
-
- If you want to receive the digest by mail, send email to listserv@ens.fr
- with no subject and one of the following commands as body:
- help Sends you a summary of commands
- subscribe csmp-digest Your Name Adds you to the mailing list
- signoff csmp-digest Removes you from the list
- Once you have subscribed, you will automatically receive each new
- issue as it is created.
-
- The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
- Questions related to the ftp site should be directed to
- scott.silver@dartmouth.edu.
-
- -------------------------------------------------------
-
- >From jeffp@amanda.dorsai.org (Jeffrey Posnick)
- Subject: Difference between BlockMove() and BlockMoveData()?
- Date: Fri, 1 Sep 1995 19:42:03 GMT
- Organization: The Dorsai Embassy
-
- The title says it all: is there any difference between BlockMove() and
- BlockMoveData()? If so, when should I use one and not the other?Thanks for
- any info you could offer, MPTA didn't even seem to know BlockMoveData()
- existed.
-
- Jeffrey Posnick | <mailto:jeffp@amanda.dorsai.org> | <mailto:ElLeon@aol.com>
- The opinions expressed above do not necessarily reflect those of my employer (which is a little strange since I'm self employed).
-
- +++++++++++++++++++++++++++
-
- >From andrewwelc@aol.com (AndrewWelc)
- Date: 1 Sep 1995 18:40:53 -0400
- Organization: America Online, Inc. (1-800-827-6364)
-
- > The title says it all: is there any difference between BlockMove() and
- > BlockMoveData()? If so, when should I use one and not the other?Thanks
- > for any info you could offer, MPTA didn't even seem to know
- > BlockMoveData() existed.
-
- Yes -- BlockMove flushes the instruction caches (on most block moves),
- while BlockMoveData doesn't. If you're just moving data around,
- BlockMoveData will be a bit faster.
-
- Regards,
-
- Andrew Welch
- Thaumaturgist
- Ambrosia Software, Inc.
-
- ..........
-
- For the latest versions of our software, technical support, and Ambrosia
- news, stop by and visit the Ambrosia Software, Inc. support forums:
-
- America Online ---> Keyword: Ambrosia
- CompuServe ---> GO word: Ambrosia
- eWorld --> Shortcut: Ambrosia
-
- +++++++++++++++++++++++++++
-
- >From Richard Wesley <hawkfish@punchdeck.com>
- Date: 2 Sep 1995 14:18:25 GMT
- Organization: Punch Deck Consulting
-
- jeffp@amanda.dorsai.org (Jeffrey Posnick) wrote:
- >The title says it all: is there any difference between BlockMove() and
- >BlockMoveData()? If so, when should I use one and not the other?Thanks for
- >any info you could offer, MPTA didn't even seem to know BlockMoveData()
- >existed.
- >
- >Jeffrey Posnick | <mailto:jeffp@amanda.dorsai.org> | <mailto:ElLeon@aol.com>
- >The opinions expressed above do not necessarily reflect those of my employer (which is a little strange since I'm self employed).
-
- ::BlockMove flushes the instruction cache, ::BlockMoveData does not. You should
- use ::BlockMoveData for data and ::BlockMove for anything else.
-
- - rmgw
-
- http://www.punchdeck.com/hawkfish/PunchDeck.html
-
- - --------------------------------------------------------------------------
- Richard Wesley hawkfish@punchdeck.com | "'Hand it round first, and cut it
- Punch Deck Consulting pnchdeck@aol.com | afterwards.'" - Lewis Carroll,
- Macintosh Software Development | "Through the Looking Glass"
- - --------------------------------------------------------------------------
-
-
-
- +++++++++++++++++++++++++++
-
- >From vision@cc.swarthmore.edu (Frank Durgin, et al.)
- Date: Sat, 02 Sep 1995 16:58:44 -0400
- Organization: Swarthmore Visual Perception Lab
-
- In article <jeffp-0109951542030001@jeffp.ppp.dorsai.org>,
- jeffp@amanda.dorsai.org (Jeffrey Posnick) wrote:
-
- > The title says it all: is there any difference between BlockMove() and
- > BlockMoveData()? If so, when should I use one and not the other?Thanks for
- > any info you could offer, MPTA didn't even seem to know BlockMoveData()
- > existed.
-
- BlockMoveData() doesn't flush the instruction cache (if any), so it's
- *slightly* faster on the '040. On 604 machines with the DRE,
- BlockMoveData() can be quite a lot faster since (at least in loops)
- flushing the caches can mean the difference between recompiling 68k
- instructions as PPC once and then running N-1 chunks of PPC code and
- recompiling 68k instructions as PPC N times. On machines with no
- instruction cache, the two calls are the same.
-
- In other words, if you are copying data rather than instructions, use
- BlockMoveData(). Can't hurt; might help.
-
-
- Ta,
- -Stephen
-
- +++++++++++++++++++++++++++
-
- >From donald@epix.net (Donald Way)
- Date: Sun, 03 Sep 1995 18:39:17 -0500
- Organization: epix.net
-
- In article <vision-0209951658440001@wallach.swarthmore.edu>,
- ssample1@swarthmore.edu wrote:
-
- > In article <jeffp-0109951542030001@jeffp.ppp.dorsai.org>,
- > jeffp@amanda.dorsai.org (Jeffrey Posnick) wrote:
- >
- > > The title says it all: is there any difference between BlockMove() and
- > > BlockMoveData()? If so, when should I use one and not the other?Thanks for
- > > any info you could offer, MPTA didn't even seem to know BlockMoveData()
- > > existed.
- >
- > BlockMoveData() doesn't flush the instruction cache (if any), so it's
- > *slightly* faster on the '040. On 604 machines with the DRE,
- > BlockMoveData() can be quite a lot faster since (at least in loops)
- > flushing the caches can mean the difference between recompiling 68k
- > instructions as PPC once and then running N-1 chunks of PPC code and
- > recompiling 68k instructions as PPC N times. On machines with no
- > instruction cache, the two calls are the same.
- >
- > In other words, if you are copying data rather than instructions, use
- > BlockMoveData(). Can't hurt; might help.
-
-
- Jeez, I guess I gotta start reading the headers more often. When did they
- sneak this one in? No reference to it ANYWHERE as far as I can tell.
- It'd be great if everytime Apple did something like this a little dogcow
- would start flashing in my task menu.
-
- BTW, do we need to test for the trap, or is there some minimum system
- configuration upon which we can simply *assume* that BlockMoveData is
- present?
-
- --
- Donald Way
- donald@epix.net
-
- +++++++++++++++++++++++++++
-
- >From steve@mindvision.com (Steve Kiene)
- Date: Mon, 04 Sep 1995 01:30:05 -0700
- Organization: MindVision Software
-
- In article <donald-0309951839170001@qrvlppp40.epix.net>, donald@epix.net
- (Donald Way) wrote:
-
- > In article <vision-0209951658440001@wallach.swarthmore.edu>,
- > ssample1@swarthmore.edu wrote:
- >
- > > In article <jeffp-0109951542030001@jeffp.ppp.dorsai.org>,
- > > jeffp@amanda.dorsai.org (Jeffrey Posnick) wrote:
- > >
- > > > The title says it all: is there any difference between BlockMove() and
- > > > BlockMoveData()? If so, when should I use one and not the other?Thanks for
- > > > any info you could offer, MPTA didn't even seem to know BlockMoveData()
- > > > existed.
- > >
- > > BlockMoveData() doesn't flush the instruction cache (if any), so it's
- > > *slightly* faster on the '040. On 604 machines with the DRE,
- > > BlockMoveData() can be quite a lot faster since (at least in loops)
- > > flushing the caches can mean the difference between recompiling 68k
- > > instructions as PPC once and then running N-1 chunks of PPC code and
- > > recompiling 68k instructions as PPC N times. On machines with no
- > > instruction cache, the two calls are the same.
- > >
- > > In other words, if you are copying data rather than instructions, use
- > > BlockMoveData(). Can't hurt; might help.
- >
- >
- > Jeez, I guess I gotta start reading the headers more often. When did they
- > sneak this one in? No reference to it ANYWHERE as far as I can tell.
- > It'd be great if everytime Apple did something like this a little dogcow
- > would start flashing in my task menu.
- >
- > BTW, do we need to test for the trap, or is there some minimum system
- > configuration upon which we can simply *assume* that BlockMoveData is
- > present?
-
-
- You don't need to test for the presence of the trap. It's simply the
- _BlockMove trap with the immediate bit set in the trap word. If a
- particular ROM doesn't support it, the bit is just ignored.
-
- Steve Kiene
- MindVision Software
-
- ---------------------------
-
- >From eddyg@vcd.hp.com (Eddy J. Gurney)
- Subject: Easiest way to get vRefNum of startup volume?
- Date: 22 Aug 1995 22:01:24 GMT
- Organization: Hewlett-Packard
-
- I want to call PBHGetVInfo and the two easiest ways appear to be
- specifying the vRefNum or the volume index. Can I make any assumptions
- about the volume index for the startup volume (i.e., is volume index
- 0 always the startup volume?) or can I always assume that the vRefNum
- will be -1 for the startup volume?
-
- If not, what is the simplest correct way to determine the vRefNum or
- volume index of the startup volume?
-
- Thanks,
- Eddy
-
- +++++++++++++++++++++++++++
-
- >From tulip@tiac.net (Ed Anson)
- Date: Tue, 22 Aug 1995 23:52:12 -0400
- Organization: Tulip Software
-
- In article <41dk3k$efh@news.vcd.hp.com>, eddyg@vcd.hp.com (Eddy J. Gurney)
- wrote:
-
- > I want to call PBHGetVInfo and the two easiest ways appear to be
- > specifying the vRefNum or the volume index. Can I make any assumptions
- > about the volume index for the startup volume (i.e., is volume index
- > 0 always the startup volume?) or can I always assume that the vRefNum
- > will be -1 for the startup volume?
- >
- > If not, what is the simplest correct way to determine the vRefNum or
- > volume index of the startup volume?
-
- The System folder is always on the startup volume.
-
- Use the Folder Manager to locate the System folder, and the resulting file
- spec will reveal the startup volume.
-
- - --------------------
- Ed Anson MediaTree: multimedia outline editor & catalog
- Tulip Software
- Andover, MA 01810 For details, check out my WWW page:
- U.S.A. <http://www.tiac.net/users/tulip/home.html>
-
- +++++++++++++++++++++++++++
-
- >From andrewwelc@aol.com (AndrewWelc)
- Date: 23 Aug 1995 00:00:04 -0400
- Organization: America Online, Inc. (1-800-827-6364)
-
- > or can I always assume that the vRefNum will be -1 for the startup
- > volume?
-
- Yep, according to Apple, it is always -1.
-
- Regards,
-
- Andrew Welch
- Thaumaturgist
- Ambrosia Software, Inc.
-
- ..........
-
- For the latest versions of our software, technical support, and Ambrosia
- news, stop by and visit the Ambrosia Software, Inc. support forums:
-
- America Online ---> Keyword: Ambrosia
- CompuServe ---> GO word: Ambrosia
- eWorld --> Shortcut: Ambrosia
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 3 Sep 1995 00:12:51 -0400
- Organization: America Online, Inc. (1-800-827-6364)
-
- andrewwelc@aol.com (AndrewWelc) replied:
-
- >> or can I always assume that the vRefNum will be -1 for the startup
- >> volume?
- >
- >Yep, according to Apple, it is always -1.
-
- With the current File Manager, it is always -1. That because the boot
- volume is mounted first and volume reference numbers are allocated
- starting with -1. However, that's not something that is guaranteed (and in
- fact, it almost changed once).
-
- Use FindFolder to find the System Folder and then use the vRefNum
- returned. That will work no matter what changes in the future.
-
- - Jim Luther
-
-
- ---------------------------
-
- >From jrs@az.com (Jonathan R. Seagrave)
- Subject: Pointers to functions on the PowerPC?
- Date: 3 Sep 1995 19:57:23 GMT
- Organization: Northwest Nexus Inc.
-
- Hi, I've been having some trouble porting 68k code to PowerPC code. I
- thought maybe I could get a pointer or two. First, (I'll focus on a
- specific problem -- I doubt I'd get much response if I asked 32767
- questions at once ;) I'm having trouble with action functions. This
- worked fine in 68k but I can't get it to run without a crash with the
- PowerPC:
-
- TrackControl(hControl, localMouse, (void *) ScrollActionProc);
-
- /*
- the prototype for ScrollActionProc is:
- pascal void ScrollActionProc(ControlHandle hControl, short partCode);
- */
-
- Tracing throught my code with a debugger shows that ScrollActionProc() is
- never run instead I get an Illegal Instruction message (apparently this
- (void *) ScrollActionProc is going of into the ozone...).
-
- I had insert the (void *) to get it to compile; it wouldn't compile any
- other way. Before the switch from 68k too PowerPC the above line read:
-
- TrackControl(hControl, localMouse, ScrollActionProc);
-
- I've never had problems with it on the 68k.
-
- Interestingly enough although I've had to typecast other function pointers
- as void* I haven't seen errors in any others. For example, these seem to
- work fine:
-
- SetGrowZone((void *) MyGrowZone);
- DeviceLoop(pWind->visRgn, (void *) GrayFrameDrawingProc, (long)
- &hFrameData, 0);
-
- I've also been having problems with this:
-
- ForEachIconDo(hIcon, svAllAvailableData, (void *) SaveCustomIcon, 0);
-
- But I can't claim it was working before as I'm writting it for the first
- time on the PowerPC.
-
- I suspect I'm Ignorant of some aspect of passing pointers to functions.
- Any tips would be appreciated.
-
- jrs http://www.az.com:/~jrs
- --
- The other day I saw a bumper sticker which read "Honk if you passed
- p-chem." I honked and the driver flipped me off. I guess he didn't pass
-
- +++++++++++++++++++++++++++
-
- >From dazuma@cco.caltech.edu (Daniel Azuma)
- Date: Mon, 04 Sep 1995 17:40:22 -0700
- Organization: California Institute of Technology, Pasadena
-
- jrs@az.com (Jonathan R. Seagrave) wrote:
-
- > Hi, I've been having some trouble porting 68k code to PowerPC code. I
- > thought maybe I could get a pointer or two. First, (I'll focus on a
- > specific problem -- I doubt I'd get much response if I asked 32767
- > questions at once ;) I'm having trouble with action functions. This
- > worked fine in 68k but I can't get it to run without a crash with the
- > PowerPC:
- >
- > TrackControl(hControl, localMouse, (void *) ScrollActionProc);
- >
- > /*
- > the prototype for ScrollActionProc is:
- > pascal void ScrollActionProc(ControlHandle hControl, short partCode);
- > */
- >
- > Tracing throught my code with a debugger shows that ScrollActionProc() is
- > never run instead I get an Illegal Instruction message (apparently this
- > (void *) ScrollActionProc is going of into the ozone...).
- >
- > I had insert the (void *) to get it to compile; it wouldn't compile any
- > other way. Before the switch from 68k too PowerPC the above line read:
- >
- > TrackControl(hControl, localMouse, ScrollActionProc);
- >
- > I've never had problems with it on the 68k.
-
- Okay, Jonathan, this is the trick when porting to PowerPC: you have to
- deal with mode switching.
-
- Parts of the toolbox are fat (both 68K and PPC) but parts are still
- 68K-only. This 68K-only code cannot call your PPC-native action function
- directly; it gets confused and tries to interpret the PPC instructions as
- 68K instructions, which results in illegal instruction errors.
-
- To deal with this, you need to specify action procedures as Universal
- ProcPtrs (UPPs). The UPP includes the address of the function, plus
- information on how to make the mode-switch from 68K to PPC. This is also
- the reason the code won't compile unless you typecast to (void *):
- TrackControl() is not expecting a function pointer, but a UPP.
-
- To do this, you use a macro to create a UPP out of the address of your
- action procedure. For the TrackControl action procedure, the macro is
- called NewControlActionProc(), and it returns a UPP of type
- ControlActionUPP. This is what needs to be passed to TrackControl. Once
- you're done, you use the DisposeRoutineDescriptor() call to release the
- UPP.
-
- So your code would look like this:
-
- ControlActionUPP myScrollActionUPP;
-
- myScrollActionUPP = NewControlActionProc(ScrollActionProc);
- TrackControl(hControl, localMouse, myScrollActionUPP);
-
- // ...When done...
- DisposeRoutineDescriptor (myScrollActionUPP);
-
- You can look at the corresponding header files in the Universal Headers to
- see what the names of the UPP-creating macros are. There's a different
- macro for each kind of callback. NewControlActionProc() is defined in
- "Controls.h". A modal dialog filter proc UPP is created by the
- NewModalFilterProc() macro, defined in "Dialogs.h".
-
- The above code will also work under 68K. When compiling PPC-native, the
- macros create the UPPs that are needed. When compiling 68K-native, they
- merely perform the necessary typecasts to make the code compile.
- Therefore, it is a good idea to use this technique from now on, in any mac
- code that you write.
-
- In general, UPPs need to be used any time where it is possible that 68K
- code will call PPC code, or PPC code will call 68K code. For instance, you
- will need to use them if part of your program is compiled 68K and part is
- PPC. The details on this more advanced usage are discussed in "IM: PowerPC
- System Software". Some info can also be gleaned by studying the header
- file "MixedMode.h".
-
- > The other day I saw a bumper sticker which read "Honk if you passed
- > p-chem." I honked and the driver flipped me off. I guess he didn't pass
-
- ROTFL! Heh, maybe I should get a bumper sticker saying "Honk if you passed
- thermal physics"...
-
- Dan
-
- +-+
- ================================================================| |=======
- \ _____ Daniel Azuma _____ \ "See what love the Father has +--+ +--+ /
- \ <dazuma@cco.caltech.edu> \ given us, that we should be +--+ +--+ /
- \ Caltech CS Student \ called children of God..." | | /
- \ Mac Programming Artist \ ---1 John 3:1 | | /
- ============================================================| |===
- | |
- +-+
-
- +++++++++++++++++++++++++++
-
- >From tulip@tiac.net (Ed Anson)
- Date: Mon, 04 Sep 1995 22:59:53 -0400
- Organization: Tulip Software
-
- In article <jrs-0309951203290001@pipe.az.com>, jrs@az.com (Jonathan R.
- Seagrave) wrote:
-
- > questions at once ;) I'm having trouble with action functions. This
- > worked fine in 68k but I can't get it to run without a crash with the
- > PowerPC:
- >
- > TrackControl(hControl, localMouse, (void *) ScrollActionProc);
- >
- > /*
- > the prototype for ScrollActionProc is:
- > pascal void ScrollActionProc(ControlHandle hControl, short partCode);
- > */
- >
- > Tracing throught my code with a debugger shows that ScrollActionProc() is
- > never run instead I get an Illegal Instruction message (apparently this
- > (void *) ScrollActionProc is going of into the ozone...).
- >
- > I had insert the (void *) to get it to compile; it wouldn't compile any
- > other way. Before the switch from 68k too PowerPC the above line read:
-
- The compiler was trying to tell you something. Too bad you lied to it and
- made it shut up :)
-
- PPC code requires that you supply a UPP instead of a normal procedure
- pointer, when setting up call-backs such as these. The current "universal"
- headers provide the appropriate declarations and methods to create
- appropriate UPPs.
-
- By casting away the type information, you fooled the compiler into
- accepting a procedure pointer where a UPP was required. The system's (68K)
- code tried to call your (PPC) code and things didn't work out as planned.
- The UPP is needed to enable the transition between emulated and native
- code.
-
- If you don't know what this is all about, there is an entire volume of NIM
- devoted to PPC programming. It is essential reading.
-
- - --------------------
- Ed Anson MediaTree: multimedia outline editor & catalog
- Tulip Software
- Andover, MA 01810 For details, check out my WWW page:
- U.S.A. <http://www.tiac.net/users/tulip/home.html>
-
- +++++++++++++++++++++++++++
-
- >From jordanz@altura.com (Jordan Zimmerman)
- Date: Tue, 05 Sep 1995 17:47:09 -0700
- Organization: Altura Software, Inc.
-
- > Hi, I've been having some trouble porting 68k code to PowerPC code. I
- > thought maybe I could get a pointer or two. First, (I'll focus on a
- > specific problem -- I doubt I'd get much response if I asked 32767
- > questions at once ;) I'm having trouble with action functions. This
- > worked fine in 68k but I can't get it to run without a crash with the
- > PowerPC:
- >
- > TrackControl(hControl, localMouse, (void *) ScrollActionProc);
- >
-
- You really should read the Inside Mac volume on PowerPC System Software.
- Any callback that goes through the MacOS (as in TrackControl) must be
- passed as a RoutineDescriptor so that the MixedMode Manager can handle it.
- A full description is beyond what can be written here.
-
- --
- Jordan Zimmerman, Altura Software
- home page: http://www.altura.com/jordanz/home.html
- Coming to you fast as lightning on a 9500/120!
-
- ---------------------------
-
- >From davidh@a.cs.okstate.edu (HILSABECK DAVID AL)
- Subject: Preferences Database project discussion
- Date: 2 Sep 1995 14:02:17 GMT
- Organization: Oklahoma State University, Stillwater OK
-
- t seems as though every time I develop a Macintosh application, implementing
- preferences seems to become more and more of a pain. There's to be a lot of
- discussion on the topic, and Apple has published guidelines for implementing
- preferences, but none of this answers the underlying question: How can I add
- preferences to my application without the pain of managing a preferences
- file?
-
- All of the problems preferences pose could easily be overcome if there
- were an automatic method of storing and retrieving data associated with an
- application. Windows programmers have had a solution (a very limited
- solution) to the preferences problem for some time. With .INI files, a
- Windows programmer simply called one of four functions to store and
- retrieve values in what amounted to preferences files. Now with Windows95
- and Windows NT, Windows programmers have the Registration Database, which is
- sort of like preferences on excessive steroids. Even the NeXT operating
- system had a database for storing preferences, even if it did become corrupt
- from time to time.
-
- The Mac OS has gone without long enough. The time has come to implement the
- Macintosh Preferences Database. This is my proposal:
-
- Implement a Preferences Database System that is composed of four parts. The
- first part is a shared library (and an equivalent ASLM or 68KCFM library)
- that implements the Preferences Manager. This provides an API for an
- application to store and retrieve preferences in the Preferences Database.
- The second part is the collection of Preferences Database files themselves.
- These files reside in the Preferences folder and are completely controlled
- by the Preferences Manager. The third part is the Preferences Utility. The
- Preferences Utility allows end-user to do some simple management of the
- contents of the Preferences Database, as well as repair the Preferences
- Database should the need arise. The fourth part is the Developer Preferences
- Utility. This utility allows a developer to view and manipulate the contents
- of the database for debugging purposes. The two utilities may be packaged as
- a single utility, with a hidden switch toggling the developer functionality.
-
- The overall structure of the database would be heirarchial. The
- root would contain a list of application signatures. Under its signature,
- an application can store a heirarchy of any data necessary to implement its
- preferences. The key to retrieve any data item from the database would be a
- parent level ID (a long) and the name of the data item (an OSType). The root
- level would have a predefined ID. There would be excessively practical
- limits imposed on the size (and content) of data stored in the database.
-
- The Preferences Database would consist of a index/sequence set stored in one
- main database file, along with extra files to store objects that would pose
- storage problems for the main database file. The structure of the main
- database file would be a b+tree with a b*tree index set. The sequence
- set would be based on an adaptive inverted list structure. Both index and
- sequence set would rely on an underlying block structure. All algorithms used
- to manipulate the index set, sequence set, and block structure would be
- fault tolerant.
-
- The Preferences Manager would simply be a set of functions stored in a shared
- library. There will be no system extensions, control panels, or background
- applications. The API presented by the Preferences Manager would allow an
- application to open the database, store and retrieve data within the database
- heirarchy, get information about the contents of the database, and otherwise
- manipulate the database. The functionality would be somewhat congruent to the
- functionality of the File Manager. When Copland is released, the Preferences
- Manager would need to modified to allow controlled, shared, re-entrant, and
- pre-emptive access to the database (which can't be done now without at least
- turning on file sharing) through a [hopefully] new File Manager API. I have
- designed an actual Preferences Manager API, but I don't want to get that
- detailed quite yet (but I will later).
-
- The functionality of the Preferences Utilities is still fuzzy. What I would
- like to see is a architecture that would allow plug-ins to decode the
- contents of custom data items for developers. Or maybe something based on
- ResEdit TMPLs. Like I said, this is still fuzzy. I can say that the
- Registration Manager/Utility in Windows NT is completely overboard. I want
- something that won't scare (or harm) end-users.
-
- Finally, the Preferences Database System would be freely distributable. As
- more applications used it, its value to both users and developers would
- increase. I've even kicked around the idea of making it portable, since
- so much cross-platform development is being done these days (trust me, I
- KNOW!).
-
- This should be enough to get the ball rolling. If you understand my
- preferences frustration and find the Preferences Database idea interesting,
- I would like to hear from you. I need know if such a project would be useful
- to other developers. I would hate to spend all the time this project would
- take (which would be my own free time) only to find that noone's interested
- in using it.
-
- Please post your comments, questions, opinions, observations, concerns, and
- constructive flames.
-
- Thanks,
- David Hilsabeck
- davidh@a.cs.okstate.edu
- david@tms-ok.mhs.compuserve.com
-
-
-
- +++++++++++++++++++++++++++
-
- >From andrewwelc@aol.com (AndrewWelc)
- Date: 2 Sep 1995 21:10:45 -0400
- Organization: America Online, Inc. (1-800-827-6364)
-
- > This should be enough to get the ball rolling. If you understand my
- > preferences frustration and find the Preferences Database idea
- > interesting, I would like to hear from you. I need know if such a
- > project would be useful to other developers. I would hate to spend all
- > the time this project would take (which would be my own free time) only
- > to find that noone's interested in using it.
-
- Sounds good to me -- let me know if you need any help.
-
- Regards,
-
- Andrew Welch
- Thaumaturgist
- Ambrosia Software, Inc.
-
- ..........
-
- For the latest versions of our software, technical support, and Ambrosia
- news, stop by and visit the Ambrosia Software, Inc. support forums:
-
- America Online ---> Keyword: Ambrosia
- CompuServe ---> GO word: Ambrosia
- eWorld --> Shortcut: Ambrosia
-
- +++++++++++++++++++++++++++
-
- >From 3gl21@qlink.queensu.ca (Gregory Lo)
- Date: Sun, 03 Sep 1995 00:34:48 -0400
- Organization: Queen's University
-
- In article <429o59$iuh@bubba.ucc.okstate.edu>, davidh@a.cs.okstate.edu
- (HILSABECK DAVID AL) wrote:
- > All of the problems preferences pose could easily be overcome if there
- > were an automatic method of storing and retrieving data associated with an
- > application. Windows programmers have had a solution (a very limited
- > solution) to the preferences problem for some time. With .INI files, a
- > Windows programmer simply called one of four functions to store and
- > retrieve values in what amounted to preferences files. Now with Windows95
- > and Windows NT, Windows programmers have the Registration Database, which is
- > sort of like preferences on excessive steroids. Even the NeXT operating
- > system had a database for storing preferences, even if it did become corrupt
- > from time to time.
-
- How about extending Internet Config to handle preferences other than those
- associated with Internet applications?
- At this point it really doesn't matter how the proposed Preferences
- Manager works internally; it could be ASLM, Component, CFM, staticly
- linked libs, etc.
- We can get started by determining an interface, which should be
- independant of how the manager is implemented. Internet Config should
- definitely be examined for inspiration.
-
- GLo
-
- - ---------------------------------------------------------
- Gregory Lo GLo ?:^(> <mailto:3gl21@qlink.queensu.ca>
-
- +++++++++++++++++++++++++++
-
- >From peter@stairways.com.au (Peter N Lewis)
- Date: Sun, 03 Sep 1995 23:37:18 +0800
- Organization: Stairways Software
-
- In article <3gl21-0309950034480001@slip120.qlink.queensu.ca>,
- 3gl21@qlink.queensu.ca (Gregory Lo) wrote:
-
- >How about extending Internet Config to handle preferences other than those
- >associated with Internet applications?
-
- IC already supports anon-internet preferences. You can store any
- preferences you want in there, there is even a defined way to avoid
- preference keys from clashing with other developers.
-
- However, IC's actual implementation for storing the prefs is not really
- stressed for handling a very large number of preferences, since it just
- uses the Resource Manager ("The Resource Manager is not a database" "yes
- it is!" "well, not a very good one" "too true!" :-). However, IC's API
- and Component Manager implementation is perfectly well suited to be a
- general purpose preference manager. Now, if someone wanted to take over
- and stick a more robust database on the back end of IC... :-)
- Peter.
- --
- "there is no significant correlation to violence on TV and agression in
- daily life" - NHR Broadcasting Culture Research Institute in Tokyo.
-
- ---------------------------
-
- >From "Andrew C. Plotkin" <erkyrath+@CMU.EDU>
- Subject: QuickTime volumes
- Date: Fri, 1 Sep 1995 13:46:04 -0400
- Organization: Carnegie Mellon, Pittsburgh, PA
-
- (This is one of those "it works, but is it a good idea?" questions.)
-
- I have a MIDI file. I convert it to a QT movie using SimpleText 1.3 (I
- have QuickTime 2.0 and the QT musical instruments installed, of
- course.)
-
- The result is a QT movie with one track, an audio track, and it does
- indeed play music. But it's awfully quiet.
-
- So I'd like to amplify it. But both GetMovieVolume (on the movie) and
- GetTrackVolume (on the track) return 1.0. That's the value 255, so
- actually I guess they're returning 0.998 or something.
-
- The documentation on SetMovieVolume and SetTrackVolume say that they
- take fixed-point values from -1.0 to 1.0. Now if I do
- SetMovieVolume(mov, GetMovieVolume(mov) * 2);
- it does get louder. In fact I can crank the multiplier up to about 5;
- beyond that it doesn't get any louder, although it still doesn't seem
- to produce any errors. But technically I'm doing something undefined
- by the documentation.
-
- To confuse matters more, I have a version of MoviePlayer (2.0b2) which
- allows me to set the track volume from 0 % to 200 %. I assume that
- setting 200% is the equivalent of
- SetTrackVolume(trak, GetTrackVolume(trak) * 2);
- So is this sort of legitimized? Is there some documentation on how
- high I can crank this thing? Am I running the risk that in some future
- (or past) version of QuickTime, it won't get any louder at all?
-
- --Z
-
- "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
-
- +++++++++++++++++++++++++++
-
- >From ldo@waikato.ac.nz (Lawrence D'Oliveiro)
- Date: Mon, 04 Sep 1995 16:52:08 +1200
- Organization: University of Waikato
-
- In article <AkFoPQW00WB3EGqmN_@andrew.cmu.edu>, "Andrew C. Plotkin"
- <erkyrath+@CMU.EDU> wrote:
-
- >So I'd like to amplify it. But both GetMovieVolume (on the movie) and
- >GetTrackVolume (on the track) return 1.0. That's the value 255, so
- >actually I guess they're returning 0.998 or something.
-
- Actually, I think there may be a slight inconsistency here. I believe the
- documentation indicates that the volume is an 8.8 fixed number, so 100%
- should really be 256, not 255. But, as you've noticed, the default volume
- setting for new movies is 255.
-
- On the other hand, it's been like this since QuickTime 1.0, so they
- probably figured it's too late to change now...
-
- >The documentation on SetMovieVolume and SetTrackVolume say that they
- >take fixed-point values from -1.0 to 1.0. Now if I do
- > SetMovieVolume(mov, GetMovieVolume(mov) * 2);
- >it does get louder. In fact I can crank the multiplier up to about 5;
- >beyond that it doesn't get any louder, although it still doesn't seem
- >to produce any errors. But technically I'm doing something undefined
- >by the documentation.
-
- In the release notes for QuickTime 1.6, it was made clear that it did now
- support volumes greater than 100%, but you needed Sound Manager 3.0 (or
- later) in order for this to work.
-
- If you hold down the shift key and click on the volume slider in a movie,
- you'll see that the volume range goes up to 300%.
-
- >To confuse matters more, I have a version of MoviePlayer (2.0b2) which
- >allows me to set the track volume from 0 % to 200 %. I assume that
- >setting 200% is the equivalent of
- > SetTrackVolume(trak, GetTrackVolume(trak) * 2);
- >So is this sort of legitimized? Is there some documentation on how
- >high I can crank this thing? Am I running the risk that in some future
- >(or past) version of QuickTime, it won't get any louder at all?
-
- I'm sure Sound Manager 3.x can apply much larger amplification factors
- than this--it's just multiplying numbers, after all. There are really only
- two potential problems:
-
- 1) If you're trying to amplify a sound that's too soft, it is liable to
- get noisy. (This will only apply to sampled-sound tracks, not music
- tracks.)
- 2) If you amplify a sound (or mixture of sounds) that _isn't_ too soft, it
- will start to clip and sound horribly distorted.
-
- Apart from watching out for these two things, what you're trying to do IS
- in fact fully supported, and should continue to remain so.
-
- PS: if you want to make the volume change permanent, you can use
- SetMoviePreferredVolume.
-
- +++++++++++++++++++++++++++
-
- >From reinder@neuretp.biol.ruu.nl (Reinder Verlinde)
- Date: Mon, 04 Sep 1995 11:53:57 +0200
- Organization: Rijksuniversiteit Utrecht
-
- In article <AkFoPQW00WB3EGqmN_@andrew.cmu.edu>, "Andrew C. Plotkin"
- <erkyrath+@CMU.EDU> wrote:
-
- >
- > The documentation on SetMovieVolume and SetTrackVolume say that they
- > take fixed-point values from -1.0 to 1.0. Now if I do
- > SetMovieVolume(mov, GetMovieVolume(mov) * 2);
- > it does get louder. In fact I can crank the multiplier up to about 5;
- > beyond that it doesn't get any louder, although it still doesn't seem
- > to produce any errors. But technically I'm doing something undefined
- > by the documentation.
- >
- It is defined in tech notes released with some upgrade. I think that
- Sound Manager 3.0 allows 'overdriving' the sound volume, so you should
- try to find the release notes for Sound Manager 3.0. I believe the new
- maximum sound volume is 0x1FF, but am not sure about it. There also
- is a new call which allows you to set volumes for left and right
- channels separately (to get cool pseudo-stereo sound movement)
-
- Reinder Verlinde
-
- Unix: the original thing wasn't designed at all.
- Then, when it got designed, it got designed by a committee.
- Worse yet, it got designed by an army of committees.
-
- ---------------------------
-
- >From klopfer@macc.wisc.edu (Eric Klopfer)
- Subject: Random Numbers
- Date: Fri, 01 Sep 1995 22:18:08 -0500
- Organization: U.W. Madison
-
- I need to generate random numbers at a fairly fine scale on the range
- 0->1. I am writing my program in Symantec C++ on a PPC. I have been
- using the built in rand() statement, but it only generates 32768 numbers
- and this is not a fine enough scale for my use. I know that the toolbox
- has a routine to generate twice this many, but this is not a substantial
- enough increase. I need 10x or 100x better resolution.
-
- Can anyone give me a good (pseudo) random-number generator that won't slow
- things down much (I use the random number generator a lot), that would
- allow me this increase in resolution?
-
- Thanks.
- >From klopfer@macc.wisc.edu (Eric Klopfer)
- Subject: Random Numbers
- Date: Fri, 01 Sep 1995 22:18:08 -0500
- Organization: U.W. Madison
-
- I need to generate random numbers at a fairly fine scale on the range
- 0->1. I am writing my program in Symantec C++ on a PPC. I have been
- using the built in rand() statement, but it only generates 32768 numbers
- and this is not a fine enough scale for my use. I know that the toolbox
- has a routine to generate twice this many, but this is not a substantial
- enough increase. I need 10x or 100x better resolution.
-
- Can anyone give me a good (pseudo) random-number generator that won't slow
- things down much (I use the random number generator a lot), that would
- allow me this increase in resolution?
-
- Thanks.
-
- +++++++++++++++++++++++++++
-
- >From Keith Wiley <keithw@wam.umd.edu>
- Date: Sat, 2 Sep 1995 00:59:49 -0400
- Organization: University of Maryland College Park
-
- On Fri, 1 Sep 1995, Eric Klopfer wrote:
-
- > I need to generate random numbers at a fairly fine scale on the range
- > 0->1. I am writing my program in Symantec C++ on a PPC. I have been
- > using the built in rand() statement, but it only generates 32768 numbers
- > and this is not a fine enough scale for my use. I know that the toolbox
- > has a routine to generate twice this many, but this is not a substantial
- > enough increase. I need 10x or 100x better resolution.
- >
- > Can anyone give me a good (pseudo) random-number generator that won't slow
- > things down much (I use the random number generator a lot), that would
- > allow me this increase in resolution?
-
- Assuming you've got memory allocation for really large numbers all
- figured out, why don't you generate two numbers and multiply them. This
- will give you any number from 0 - 1073741824. I'm fairly certain various
- numbers in this sequence would be more likely than others, however, as
- you approach the more centrally-based numbers, but if that ok, this is a
- wonderful solution. Two calls to rand() won't take up too much more
- computation.
-
- . . .. ... ..... ........ ............. .....................
- .. ... ..... ....... ........... ............. .................
- . .. .... ........ ................ ................................
- Keith Wiley, Electrogenetic Engineer *
- University of Maryland at College Park * * * * * *
- email: keithw@wam.umd.edu *** ** * * ** *
- world wide web: http://www.wam.umd.edu/~keithw * ** ** ***
-
-
- +++++++++++++++++++++++++++
-
- >From dmpalmer@clark.net (David M. Palmer)
- Date: 2 Sep 1995 09:54:44 -0400
- Organization: Clark Internet Services, Inc., Ellicott City, MD USA
-
- Keith Wiley <keithw@wam.umd.edu> writes:
-
- >On Fri, 1 Sep 1995, Eric Klopfer wrote:
-
- >> I need to generate random numbers at a fairly fine scale on the range
- >> 0->1. I am writing my program in Symantec C++ on a PPC. I have been
-
- >Assuming you've got memory allocation for really large numbers all
- >figured out, why don't you generate two numbers and multiply them. This
- >will give you any number from 0 - 1073741824. I'm fairly certain various
-
- Bad idea. In general, you don't get random numbers by doing random things.
-
- Even built-in random number geenerators are often unsuitable for serious
- work, especially those that use the linear-congruential method (where
- Newrand = (oldrand * A + B) % C ).
-
- Look in 'Numerical Recipies in C' by Teukolsky (sp?) et al. for
- good random number generators.
-
- --
- David Palmer
- palmer@alumni.caltech.edu
- dmpalmer@clark.net
-
- +++++++++++++++++++++++++++
-
- >From Jonathan Salz <jsalZ@grex.cyberspace.org>
- Date: 3 Sep 1995 02:50:03 GMT
- Organization: Grex
-
- In article <klopfer-0109952218080001@f181-218.net.wisc.edu> Eric Klopfer,
- klopfer@macc.wisc.edu writes:
- >I need to generate random numbers at a fairly fine scale on the range
- >0->1. I am writing my program in Symantec C++ on a PPC. I have been
- >using the built in rand() statement, but it only generates 32768 numbers
- >and this is not a fine enough scale for my use. I know that the toolbox
- >has a routine to generate twice this many, but this is not a substantial
- >enough increase. I need 10x or 100x better resolution.
- >
- >Can anyone give me a good (pseudo) random-number generator that won't
- slow
- >things down much (I use the random number generator a lot), that would
- >allow me this increase in resolution?
-
- The other respondees to this article are right--rand() is not a terrific
- random
- number generator. Even if you're satisfied with rand(), multiplying the
- results
- of two calls to rand() won't give you good random numbers, because
- numbers with
- lots of factors will pop up often and prime number won't pop up at all.
- You
- can, however, get random numbers from 0 to 2^30 if you just bitshift the
- result
- of one call to rand() by 15 to the left, and add the result of another
- call to
- rand():
-
- unsigned long rand30() { return (rand() << 15) + rand(); }
-
- - Jonathan Salz
- - jsalz@grex.cyberspace.org
-
- +++++++++++++++++++++++++++
-
- >From preilly@isoquantic.com (Patrick L. Reilly)
- Date: Sat, 02 Sep 1995 14:51:17 -0700
- Organization: IsoQuantic Technologies, LLC
-
- In article <klopfer-0109952218080001@f181-218.net.wisc.edu>,
- klopfer@macc.wisc.edu (Eric Klopfer) wrote:
-
- | I need to generate random numbers at a fairly fine scale on the range
- | 0->1. I am writing my program in Symantec C++ on a PPC. I have been
- | using the built in rand() statement, but it only generates 32768 numbers
- | and this is not a fine enough scale for my use. I know that the toolbox
- | has a routine to generate twice this many, but this is not a substantial
- | enough increase. I need 10x or 100x better resolution.
- |
- | Can anyone give me a good (pseudo) random-number generator that won't slow
- | things down much (I use the random number generator a lot), that would
- | allow me this increase in resolution?
- |
- | Thanks.
-
-
- Try this on for size:
-
-
- #include <stdio.h>
- #include <math.h>
- #include <console.h>
-
- /*
- Prime modulus multiplicative linear congruential generator
- */
- #define MODULUS 2147483647
- #define MULT1 24112
- #define MULT2 26143
-
- static long zrng[] = {0,
- 1973272912, 281629770, 20006270, 1280689831,
- 2096730329, 1933576050,
- 913566091, 246780520, 1363774876, 604901985,
- 1511192140, 1259851944,
- 824064364, 150493284, 242708531, 75253171,
- 1964472944, 1202299975,
- 233217322, 1911216000, 726370533, 403498145,
- 993232223, 1103205531,
- 762430696, 1922803170, 1385516923, 76271663,
- 413682397, 726466604,
- 336157058, 1432650381, 1120463904, 595778810,
- 877722890, 1046574445,
- 68911991, 2088367019, 748545416, 622401386,
- 2122378830, 640690903,
- 1774806513, 2132545692, 2079249579, 78130110,
- 852776735, 1187867272,
- 1351423507, 1645973084, 1997049139, 922510944,
- 2045512870, 898585771,
- 243649545, 1004818771, 773686062, 403188473,
- 372279877, 1901633463,
- 498067494, 2087759558, 493157915, 597104727,
- 1530940798, 1814496276,
- 536444882, 1663153658, 855503735, 67784357,
- 1432404475, 619691088,
- 119025595, 880802310, 176192644, 1116780070,
- 277854671, 1366580350,
- 1142483975, 2026948561, 1053920743, 786262391,
- 1792203830, 1494667770,
- 1923011392, 1433700034, 1244184613, 1147297105,
- 539712780, 1545929719,
- 190641742, 1645390429, 264907697, 620389253,
- 1502074852, 927711160,
- 364849192, 2049576050, 638580085, 547070247};
-
- double random(stream)
- int stream;
- {
- long zi, lowprd, hi31;
-
- zi = zrng[stream];
- lowprd = (zi & 65535) * MULT1;
- hi31 = (zi >> 16) * MULT1 + (lowprd >> 16);
- zi = ((lowprd & 65535) - MODULUS) +
- ((hi31 & 32767) << 16) + (hi31 >> 15);
- if(zi < 0) zi += MODULUS;
- lowprd = (zi & 65535) * MULT2;
- hi31 = (zi >> 16) * MULT2 + (lowprd >> 16);
- zi = ((lowprd & 65535) - MODULUS) +
- ((hi31 & 32767) << 16) + (hi31 >> 15);
- if(zi < 0) zi += MODULUS;
- zrng[stream] = zi;
- return ((zi >> 7 | 1) + 1)/16777216.0;
- }
-
- --
- IsoQuantic Technologies | 1857 W. Calle Del Norte, Chandler, AZ 85224
- Patrick L. Reilly,Gen.Mgr.| Voice: +1.602.917.9543 Fax: +1.602.917.9493
- preilly@isoquantic.com | Network Architecture, Design & Analysis
-
- +++++++++++++++++++++++++++
-
- >From Mark Williams <Mark@streetly.demon.co.uk>
- Date: Sun, 03 Sep 95 15:46:20 GMT
- Organization: Streetly Software
-
-
- In article <42b54r$nmk@oak.oakland.edu>, Jonathan Salz writes:
-
- >
- > In article <klopfer-0109952218080001@f181-218.net.wisc.edu> Eric Klopfer,
- > klopfer@macc.wisc.edu writes:
- > >I need to generate random numbers at a fairly fine scale on the range
- > >0->1. I am writing my program in Symantec C++ on a PPC. I have been
- > >using the built in rand() statement, but it only generates 32768 numbers
- > >and this is not a fine enough scale for my use. I know that the toolbox
- > >has a routine to generate twice this many, but this is not a substantial
- > >enough increase. I need 10x or 100x better resolution.
- > >
- > >Can anyone give me a good (pseudo) random-number generator that won't
- > slow
- > >things down much (I use the random number generator a lot), that would
- > >allow me this increase in resolution?
- >
- > The other respondees to this article are right--rand() is not a terrific
- > random
- > number generator. Even if you're satisfied with rand(), multiplying the
- > results
- > of two calls to rand() won't give you good random numbers, because
- > numbers with
- > lots of factors will pop up often and prime number won't pop up at all.
- > You
- > can, however, get random numbers from 0 to 2^30 if you just bitshift the
- > result
- > of one call to rand() by 15 to the left, and add the result of another
- > call to
- > rand():
- >
- > unsigned long rand30() { return (rand() << 15) + rand(); }
-
- I doubt this will work either. I dont know the algorithm rand uses, but I suspect that it will have
- a fairly short cycle length (certainly much less than 2^30), and since rand30 will halve this cycle
- length, you will get a fairly sparse set of results.
-
- - --------------------------------------
- Mark Williams<Mark@streetly.demon.co.uk>
-
- +++++++++++++++++++++++++++
-
- >From klopfer@macc.wisc.edu (Eric Klopfer)
- Date: Mon, 04 Sep 1995 14:42:30 -0500
- Organization: U.W. Madison
-
- I got the following response about one of the techniques posted. I
- thought others might be interested as well.
-
- Please refer to:
-
- Simulation Modeling & Analysis, Law/Kelton, McGraw-Hill, 1990, ISBN
- 0-07-036698-5
-
- for more information about the random number generator I (Patrick L.
- Reilly) posted. This book
- should be read by anyone planning a simulation activity using random number
- generators. Unfortunately, many folks think that just calling the system
- rand() function is sufficiently random. Pity the client who relies upon the
- results of such a simulation.
-
- Essentially, the number is the length of the random number cycle and the
- largest possible number that can be represented on a 32-bit computer. The
- list of numbers *are* seeds for the 100 random number streams that are
- possible with this code. This way you can have different random numbers
- generators for different processes in the same model. The streams are
- around 100,000 numbers apart and specially selected to reduce stream
- overlap and the few badly correlated cycles in this type of random number
- generator.
-
- ---------------------------
-
- >From troika@panix.com (Mark Coniglio)
- Subject: [Q] Gestalt to determine number of serial ports?
- Date: Mon, 28 Aug 1995 18:41:48 -0500
- Organization: Troika Ranch
-
- I am updating an app that uses the serial driver on the powerbooks. I
- would like to be able to determine if there are two serial ports (e.g.,
- 140, 160, 180, etc.) or just one (e.g., 500 series). In the "Gestalt
- Selectors List 2.9" which has appeared in this newsgroup, there is a
- 'port' selector that seems that it would provide this information. It is
- documented there as:
-
- gestaltPortAttr? = 'port';
- gestaltHasInternalModem? = 0?;
- gestaltHasExternalPrinter? = 1?;
- gestaltHasExternalModem? = 2?;
-
- In fact, this call does not always return a 1 in the third bit if there is
- a printer port. Though undocumented, I verified that this 'port' selector
- is used by the Chooser in my copy of system 7.5 on my desktop Mac by
- setting an A-Trap Break in MacsBug.
-
- Though a recognized Gestalt selector would be the ideal solution, any
- other reliable (and machine independent) methods for determining the
- number of ports would be useful.
-
- Please email to troika@panix.com or post to this newsgroup.
-
- Thanks a million
- Mark Coniglio
-
- --
- mail: troika@panix.com
- http: www.art.net/Studios/Performance/Dance/Troika_Ranch/TroikaHome.html
-
- +++++++++++++++++++++++++++
-
- >From Chrisoft@planete.net (Christophe ANDRES)
- Date: Tue, 29 Aug 1995 22:47:17 +0200
- Organization: Chrisoft
-
- In article <troika-2808951841480001@troika.dialup.access.net>,
- troika@panix.com (Mark Coniglio) wrote:
-
- >
- > Though a recognized Gestalt selector would be the ideal solution, any
- > other reliable (and machine independent) methods for determining the
- > number of ports would be useful.
- >
- > Please email to troika@panix.com or post to this newsgroup.
- >
-
- I don't know of a gestalt selector counting the serial ports, but using
- the comm Toolbox, in one of my programs, I have to get them to show a
- list. I think this could be of help.
-
- P.S. : this is an taken directly from a MacApp programm.
-
- {
- CRMRec c;
- CRMRecPtr cPtr = &c;
- CRMSerialPtr serialPtr;
- comPortID theComPort;
-
- c.crmDeviceType = crmSerialDevice; // to look only for serial ports
- c.crmDeviceID = 0;
- while (cPtr != nil) // Browse through all entries
- {
- cPtr = CRMSearch(cPtr);
- if (cPtr)
- {
- serialPtr = (CRMSerialPtr)cPtr->crmAttributes;
- c.crmDeviceID = cPtr->crmDeviceID;
-
- theComPort.portName = CStr255(*(serialPtr->name));
- theComPort.portIcon = serialPtr->deviceIcon;
- this->InsertElementsBefore(fSize + 1, &theComPort, 1);
- }
- }
- }
-
- --
- Chrisoft
- >From troika@panix.com (Mark Coniglio)
-
- +++++++++++++++++++++++++++
-
- >From j-jahnke@uchicago.edu (Jerome Jahnke)
- Date: Mon, 4 Sep 1995 17:14:53 GMT
- Organization: BSD Academic Computing
-
- In article <troika-2808951841480001@troika.dialup.access.net>,
- troika@panix.com (Mark Coniglio) wrote:
-
- > I am updating an app that uses the serial driver on the powerbooks. I
- > would like to be able to determine if there are two serial ports (e.g.,
- > 140, 160, 180, etc.) or just one (e.g., 500 series). In the "Gestalt
- > Selectors List 2.9" which has appeared in this newsgroup, there is a
- > 'port' selector that seems that it would provide this information. It is
- > documented there as:
- >
- > gestaltPortAttr? = 'port';
- > gestaltHasInternalModem? = 0?;
- > gestaltHasExternalPrinter? = 1?;
- > gestaltHasExternalModem? = 2?;
- >
- > In fact, this call does not always return a 1 in the third bit if there is
- > a printer port. Though undocumented, I verified that this 'port' selector
- > is used by the Chooser in my copy of system 7.5 on my desktop Mac by
- > setting an A-Trap Break in MacsBug.
-
- Use the comm toolbox. It has the CRMSerialRecords that are a list of all
- serial connections your machine can make. You can then sort through them.
- It makes your software much more portable. It also includes snazzy icon
- families and real text descriptions of the names of the ports.
-
- Jer,
-
- --
- Jerome Jahnke
- BSD Academic Computing
- j-jahnke@uchicago.edu
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-